﻿Imports Microsoft.VisualBasic
Imports SchemaAudit

Public Class CSession : Inherits Framework.CSessionBase

#Region "Current Login"
    Public Shared ReadOnly Property IsAdmin() As Boolean
        Get
            Return IsLoggedIn AndAlso CUser.Current.IsInRole("Administrators")
        End Get
    End Property
    Public Shared ReadOnly Property IsLoggedIn() As Boolean
        Get
            Return CUser.IsLoggedIn
        End Get
    End Property
    Public Shared ReadOnly Property User() As CUser
        Get
            Return CUser.Current
        End Get
    End Property
#End Region
    Public Shared Property PageMessage() As String
        Get
            Return GetStr("PageMessage")
        End Get
        Set(ByVal value As String)
            GetStr("PageMessage", value)
        End Set
    End Property
#Region "Search Filters - AuditTrail"
    Public Shared Function AuditTrailFilters() As CAudit_SearchFilters
        Dim filters As CAudit_SearchFilters = CType([Get]("AuditTrailFilters"), CAudit_SearchFilters)
        If IsNothing(filters) Then
            filters = New CAudit_SearchFilters
            [Set]("AuditTrailFilters", filters)
        End If
        Return filters
    End Function
#End Region

#Region "Sql - Current Query"
    Public Shared Property SqlIsSelect() As Boolean
        Get
            Return GetBool("SqlIsSelect")
        End Get
        Set(ByVal value As Boolean)
            SetBool("SqlIsSelect", value)
        End Set
    End Property
    Public Shared Property SqlAllClients() As Boolean
        Get
            Return GetBool("SqlAllClients")
        End Get
        Set(ByVal value As Boolean)
            SetBool("SqlAllClients", value)
        End Set
    End Property
    Public Shared Property SqlStatement() As String
        Get
            Return GetStr("SqlStatement")
        End Get
        Set(ByVal value As String)
            SetStr("SqlStatement", value)
        End Set
    End Property
    Public Shared Property SqlUseConn() As String
        Get
            Return GetStr("SqlUseConn")
        End Get
        Set(ByVal value As String)
            SetStr("SqlUseConn", value)
        End Set
    End Property


#End Region

End Class
